// read.js
const fs = require("fs");
const yaml = require("js-yaml");
const yamlFilepath = "data.yaml";
function read() {
  let fileContents = fs.readFileSync(yamlFilepath, "utf8");
  let data = yaml.load(fileContents);
  return data;
}
function write(data) {
  let yamlStr = yaml.dump(data);
  fs.writeFileSync(yamlFilepath, yamlStr, "utf8");
}

module.exports = {
  read,
  write,
};
